/**
 *
 */
package de.cbf.cam.dsa.services.impl.rcp_provider.factorys;

import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceRegistration;

import de.cbf.cam.dsa.services.impl.rcp_provider.ProviderRace;
import de.cbf.cam.dsa.services.impl.rcp_provider.extension.RCPServiceImplExtensionPointResovler;
import de.cbf.cam.dsa.services.impl.rcp_provider.extension.interfaces.IRCPPersisterRace;
import de.cbf.cam.dsa.services.interfaces.rcp_provider.IServiceDSAProviderRace;

/**
 * @author salter
 *
 */
public class ServiceFactoryProviderRaceDSA implements ServiceFactory<IServiceDSAProviderRace> {

	/**
	 *
	 */
	public ServiceFactoryProviderRaceDSA() {
	}

	@Override
	public IServiceDSAProviderRace getService(Bundle bundle,
			ServiceRegistration<IServiceDSAProviderRace> registration) {
		return getService();
	}

	@Override
	public void ungetService(Bundle bundle,
			ServiceRegistration<IServiceDSAProviderRace> registration,
			IServiceDSAProviderRace service) {
	}

	public IServiceDSAProviderRace getService(){
		ProviderRace provider = new ProviderRace();
		IRCPPersisterRace persister = RCPServiceImplExtensionPointResovler.getInstance().getPreferredRacePersister();
		provider.setPersister(persister);
		return provider;
	}
}
